class Solution:
    def removeElement(self, nums: List[int], val: int) -> int:
        while val in nums:
            nums.remove(val)
        return len(nums)

    def removeElement2(self, nums: List[int], val: int) -> int:
        i = nums.count(val)
        while i > 0:
            nums.remove(val)
            i -= 1
        return len(nums)